package com.honey.mybatis.generator.criteria.method;

import com.honey.compilation.java.Clazz;
import com.honey.compilation.java.JavaKeyWord;
import com.honey.core.dbmapping.introspect.IntrospectSchema;
import com.honey.core.dbmapping.introspect.IntrospectSchemaColumn;
import com.honey.core.types.FullyQualifiedJavaType;
import com.honey.mybatis.generator.AbstractMethod;
import com.honey.mybatis.generator.MybatisPlugin;
import com.honey.mybatis.generator.criteria.CriteriaConstant;

public class GetCriteriaMethod extends AbstractMethod {

	private static final String METHOD_NAME =CriteriaConstant.GET_CRITERIA;
	
	private static final FullyQualifiedJavaType RETURN_TYPE = new FullyQualifiedJavaType("java.util.List<"+CriteriaConstant.CRITERION_CLASS_NAME+"> "); 
	
	private static final String[] BODY = new String[]{
		JavaKeyWord.RETURN +
		JavaKeyWord.OPERATION_THIS.toString() + 
		CriteriaConstant.CRITERION_FIELD_NAME,
	};
	
	public GetCriteriaMethod(){
	}
	public GetCriteriaMethod(Clazz clazz, MybatisPlugin belongPlugin,
			IntrospectSchema introspectSchema,
			IntrospectSchemaColumn introspectSchemaColumn) {
		super(clazz, belongPlugin, introspectSchema, introspectSchemaColumn);
	}
		
	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getMethodName()
	 */
	@Override
	protected String getMethodName() {
		return METHOD_NAME;
	}

	/*
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getBody()
	 */
	@Override
	protected String[] getBody() {
		
		return BODY;
	}
	
	/*
	 * 
	 * (non-Javadoc)
	 * @see com.honey.mybatis.generator.AbstractMethod#getReturnType()
	 */
	@Override
	protected FullyQualifiedJavaType getReturnType() {

		return RETURN_TYPE;
	}
	
	public static void main(String []args){
		GetCriteriaMethod  cm = new GetCriteriaMethod();
		System.out.println(cm.createMethod().compiledContent(0)); 
	}
}
